package com.neusoft.controller;

import com.neusoft.po.CommonResult;
import com.neusoft.po.Remark;
import com.neusoft.service.RemarkService;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//import com.neusoft.po.VirtualWalletTransaction;

@RestController
@RequestMapping("/RemarkController")
@RefreshScope
public class RemarkController {

    @Autowired
    private RemarkService remarkService;

    //需要businessId
    @RequestMapping("/listRemarksByBussinessId")
    public CommonResult<List> listRemarksByBussinessId(Remark remark){
        return new CommonResult(200,"success",remarkService.listRemarksByBussinessId(remark.getBusinessId()));
    }

    //需要userId,businessId,userName,remark
    @RequestMapping("/saveRemarks")
    public CommonResult<Integer> saveRemarks(Remark remark) {
        return new CommonResult(200,"success", remarkService.saveRemarks(remark));
    }

    //需要userId
    @RequestMapping("/removeAllRemarksByUserId")
    public CommonResult<List> removeAllRemarksByUserId(String userId){
        return new CommonResult(200,"success",remarkService.removeAllRemarksByUserId(userId));
    }

    @RequestMapping("/removeOneRemarksByUserId")
    public CommonResult<List> removeOneRemarksByUserId(String userId,  int remarkId){
        return new CommonResult(200,"success",remarkService.removeOneRemarksByUserId(userId, remarkId));
    }
}
